/** 
  Copyright (c) 2008, 2009 Claudio Imbrenda
  This program is released under the terms of the
  GNU GPL version 3 or later.
*/
package macchina;
/**
 * Rappresenta una coppia con tipo.
 * 
 * @author Claudio Imbrenda
 * @param <F> tipo del primo elemento
 * @param <S> tipo del secondo elemento
 */
public class Pair<F, S> implements Cloneable{
  public F a;
  public S b;

  public Pair() {
	a = null;
	b = null;
  }

  public Pair(F f, S s) {
	a = f;
	b = s;
  }

  public boolean equals(Pair o) {
	return (o.a.equals(a)) && (o.b.equals(b));
  }

  public boolean equals(Object o) {
	if (o instanceof Pair) return equals((Pair) o);
	else return false;
  }

  public int hashCode() {
	return (a!=null?a.hashCode():0) + (b!=null?b.hashCode():0);
  }
  
  public String toString(){
    return "<"+a+","+b+">";
  }

}
